<template>
	<view style="padding-bottom: 150rpx;">
	　　<view class="uni_header">
			<view class="head_inner">
				<view class="head_inner_left" style="margin-left: 30rpx;">
					<!-- <text class="head_inner_left_text">[059401]个人名字</text> -->
				</view>
				<view class="head_inner_right">
					<image class="head_inner_left_icon" src="../../../common/img/jilu.png" mode=""></image>
					<text class="head_inner_right_text" @tap="toWithdrawal(1)">提现</text>
				</view>
			</view>
			<view class="header_money" style="margin: 0"><text class="header_money_icon">￥</text><text class="header_money_number">{{info.agent_total_share}}</text></view>
			<view class="total_money" style="margin-bottom: 40rpx;">总分成</view>
			<view class="money_details">
				<view class="money_details_inner"> 
					<view class="money_details_number">￥{{info.agent_account_balance}}</view>
					<view class="money_details_text">账户余额</view>
				</view>
				<view class="detail_br"></view>
				<view class="money_details_inner">
					<view class="money_details_number">￥{{info.agent_settled}}</view>
					<view class="money_details_text">已结算</view>
				</view>
			</view>
		</view>
		<view class="margin-sm margin-right-lg" @tap="tomessage" style="margin-top: -50rpx;">
			<wyb-noticeBar :text="ads" style="border-radius:50rpx;"/>
		</view>
		
		<!-- <view class="main">
			<view class="content" :style="'color:'+color+';background-color:'+backgroundColor+';border-color:'+borderColor+';height:'+height">
				<view v-for="(item,index) in ads" :key="index">
					<view class="swiper-item" v-if="showIndex==index" :style="'line-height:'+height">{{item}}</view>
				</view>
			</view>
		</view> -->
		
		<view class="operating_box">
			<view class="operating_header">
				<view class="operating_header_left">
					<text class="operating_header_text">本月运营</text>
				</view>
			</view>
			<view class="operating_box_inner">
				<view class="money_details_inner money_details_inner1">
					<view class="money_details_number" style="color: #333333;">￥{{info.order_income}}</view>
					<view class="money_details_text" style="color: #666666;">月订收入(元)</view>
				</view>
				<view class="detail_br" style="border-left: 1rpx solid #EDEDED;position: relative;top: 25rpx;"></view>
				<view class="money_details_inner money_details_inner1">
					<view class="money_details_number" style="color: #333333;">{{info.order_num}}</view>
					<view class="money_details_text" style="color: #666666;">本月订单</view>
				</view>
				<view class="detail_br" style="border-left: 1rpx solid #EDEDED;position: relative;top: 25rpx;"></view>
				<view class="money_details_inner money_details_inner1">
					<view class="money_details_number" style="color: #333333;">￥{{info.set_meal_income}}</view>
					<view class="money_details_text" style="color: #666666;">套餐收入</view>
				</view>
			</view>
			<view class="operating_box_inner">
				<view class="money_details_inner money_details_inner1">
					<view class="money_details_number" style="color: #333333;">￥{{info.norder_income}}</view>
					<view class="money_details_text" style="color: #666666;">今日收入</view>
				</view>
				<view class="detail_br" style="border-left: 1rpx solid #EDEDED;position: relative;top: 25rpx;"></view>
				<view class="money_details_inner money_details_inner1">
					<view class="money_details_number" style="color: #333333;">{{info.norder_num}}</view>
					<view class="money_details_text" style="color: #666666;">今日订单</view>
				</view>
				<view class="detail_br" style="border-left: 1rpx solid #EDEDED;position: relative;top: 25rpx;"></view>
				<view class="money_details_inner money_details_inner1">
					<view class="money_details_number" style="color: #333333;">￥{{info.yorder_income}}</view>
					<view class="money_details_text" style="color: #666666;">昨日收入</view>
				</view>
			</view>
			<view class="operating_box_inner">
				<view class="money_details_inner money_details_inner1">
					<view class="money_details_number" style="color: #333333;">{{info.yorder_num}}</view>
					<view class="money_details_text" style="color: #666666;">昨日订单</view>
				</view>
				<view class="detail_br" style="border-left: 1rpx solid #EDEDED;position: relative;top: 25rpx;"></view>
				<view class="money_details_inner money_details_inner1">
					<view class="money_details_number" style="color: #333333;">{{info.nset_meal_income}}</view>
					<view class="money_details_text" style="color: #666666;">当天套餐收入</view>
				</view>
				<view class="detail_br" style="border-left: 1rpx solid #EDEDED;position: relative;top: 25rpx;"></view>
				<view class="money_details_inner money_details_inner1">
					<view class="money_details_number" style="color: #333333;">{{info.yset_meal_income}}</view>
					<view class="money_details_text" style="color: #666666;">昨天套餐收入</view>
				</view>
			</view>
		</view>
		<view class="operating_box" style="margin-top: 30rpx;">
			<view class="operating_header">
				<view class="operating_header_left">
					<text class="operating_header_text">运营情况</text>
				</view>
			</view>
			<view class="operating_box_inner">
				<view class="money_details_inner money_details_inner1">
					<view class="money_details_number" style="color: #333333;">￥{{info.aorder_income}}</view>
					<view class="money_details_text" style="color: #666666;">订单收入</view>
				</view>
				<view class="detail_br" style="border-left: 1rpx solid #EDEDED;position: relative;top: 25rpx;"></view>
				<view class="money_details_inner money_details_inner1">
					<view class="money_details_number" style="color: #333333;">{{info.aorder_num}}</view>
					<view class="money_details_text" style="color: #666666;">订单数量</view>
				</view>
				<view class="detail_br" style="border-left: 1rpx solid #EDEDED;position: relative;top: 25rpx;"></view>
				<view class="money_details_inner money_details_inner1">
					<view class="money_details_number" style="color: #333333;">￥{{info.aset_meal_income}}</view>
					<view class="money_details_text" style="color: #666666;">套餐收入</view>
				</view>
			</view>
		</view>
		<view class="operating_box" style="margin-top: 30rpx;">
			<view class="zhangdan">基础功能</view>
			<view class="operating_box_inner base_line" style="margin-top: 49rpx;">
				<view class="base_inner"  @tap="toew">
					<image class="base_inner_icon" src="../../../common/img/xiaoqu.png" mode=""></image>
					<view class="base_inner_text">小区管理</view>
				</view>
				<view class="base_inner" @tap="tosettlementRecords">
					<image class="base_inner_icon" src="../../../common/img/wuye.png" mode=""></image>
					<view class="base_inner_text">结算记录</view>
				</view>
			</view>
		</view>
		<view class="box ">
			<view class="cu-bar tabbar bg-white foot solids-top shadow">
				<view class="action" @tap="toindex">
					<view class="cuIcon-cu-image" >
						<image src="../../../common/img/zhinan.png"></image>
					</view>
					<view class="text-green">首页</view>
				</view>
				<view class="action"  @tap="tocount">
					<view class="cuIcon-cu-image">
						<image src="../../../static/tabbar/baobiao_hui.png"></image>
					</view>
					<view class="text-gray">经营报表</view>
				</view>
				<view class="action" @tap="toorder">
					<view class="cuIcon-cu-image">
						<image src="../../../common/img/ren@2x.png"></image>
					</view>
					<view class="text-gray">订单</view>
				</view>
			</view>
		</view>
	</view>
		
	</view>
</template>

<script>
	import wybNoticeBar from '@/components/wyb-noticeBar/wyb-noticeBar.vue'
	export default {
		components: {
			wybNoticeBar
		},
		data() {
			return {
				showIndex:0, //当前展示的轮播
				timer:{},
				info:{
				agent_total_share:0.00,	//浮点型	代理总分成
				agent_account_balance:0.00,//	浮点型	代理账户余额
				agent_settled:0.00,//浮点型	代理已结算
				order_num:0,//	整型	当月订单
				order_income:0.00,//	浮点型	当月订单收入
				set_meal_income:0.00,//	浮点型	当月套餐收入
				norder_num:0,//	整型	当天订单
				norder_income:0.00,//	浮点型	当天订单收入
				yorder_num:0.00,//	浮点型	昨天订单
				yorder_income:0.00,//	浮点型	昨天订单收入
				aorder_num:0,//	整型	总订单
				aorder_income:0.00,//	浮点型	总订单收入
				aset_meal_income:0.00	//浮点型	总套餐收入
		      },
			  ads:[]
			}
		},
		onLoad() {
			
		},
		onShow() {
			this.getBaseInfo();
			this.getAds();
		},
		methods: {
			getBaseInfo(){
				let that=this;
				that.http.tokenreq({
					url: 'agent/v1/getinfo'
				}).then((res) => {
					let e=res.data;
					console.log("e.data="+JSON.stringify(e.data));
					if(e.code==0 && e.success){
						that.info = e.data
					}else{
						uni.showModal({
							content:e.message,
							showCancel:false,
						})
					}
				})
			},
			getAds(){
				let that=this;
				that.http.tokenreq({
					url: 'agent/v1/getnotice'
				}).then((res) => {
					let e=res.data;
					console.log("e.rows="+JSON.stringify(e.rows));
					if(e.code==0 && e.success){
						let ads=[];
						let list = e.rows;
						list.forEach(item => {
							//ads+=item.title+",";
							ads.push(item.title)
						});
						console.log("--"+ads);
						that.ads=ads
						console.log("--"+ads);
					}else{
						uni.showModal({
							content:e.message,
							showCancel:false,
						})
					}
				})
			},
			//小区管理
			toew(){
				uni.navigateTo({
					url:'/pages/agent/communityList/communityList'
				})
			},
			//结算记录
			tosettlementRecords(){
				uni.navigateTo({
					url: '/pages/agent/settlementRecords/settlementRecords'
				})
			},
			//代理首页
			toindex(){
				uni.navigateTo({
					url: '/pages/agent/myAgent/myAgent'
				})
			},
			//经营报表
			tocount(){
				uni.navigateTo({
					url: '/pages/agent/count/count'
				})
			},
			//代理订单
			toorder(){
				uni.navigateTo({
					url: '/pages/agent/communityList/order'
				})
			},
			//消息
			tomessage(){
				uni.navigateTo({
					url: '/pages/message/noticeList/noticeList'
				})
			},
			// 我要提现
			toWithdrawal(type){
				uni.navigateTo({
					url:"/pages/toWithdrawal/toCash?balance="+this.info.agent_account_balance
					+"&type="+type
				})
			},
        },
	}
</script>
<style>
	.cu-bar.tabbar .action [class*="cuIcon-"]{
		width: 80rpx;
		height:55rpx;
	} 
	.cu-bar.tabbar{
		height:120rpx !important;
	}
	.cu-bar.tabbar .action{
		height:80rpx;
	}
	.head_inner_right{
		width: 160rpx;
	}
</style>

